package com.lightsh.common;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;

import com.lightsh.db.DbDataHelper;
import com.lightsh.list.AbstractListItem;

public class PaintItem extends AbstractListItem{
	public static final int PAINT_TYPE_NORMAL = 0;
	public static final int INVALID_ID = -1;
	
	private static final long serialVersionUID = 1L;
	
	private long mId;
	private int mType = PAINT_TYPE_NORMAL;
	private long mLastlyTime;
	private long mCreateTime;
	private String mText;
	private int mWidth;
	private int mHeight;
	
	private ArrayList<PaintStroke> mStrokes;
	
	public PaintItem(long id,String text, long time, long createTime, int width, int height){
		mId = id;
		mLastlyTime = time;
		mText = text;
		mCreateTime = createTime;
		mWidth = width;
		mHeight = height;
	}
	public long getId(){
		return mId;
	}
	public int getWidth(){
		return mWidth;
	}
	public int getHeight(){
		return mHeight;
	}
	public String getText(){
		return mText;
	}
	public long getLastlyTime(){
		return mLastlyTime;
	}
	public long getCreateTime(){
		return mCreateTime;
	}
	public int getType(){
		return mType;
	}
	public ArrayList<PaintStroke> getStrokeList(Context context){
		if(mStrokes == null){
			initStrokeList(context);
		}
		return mStrokes;
	}
	private void initStrokeList(Context context){
		if(mStrokes != null){
			mStrokes.clear();
		}else{
			mStrokes = new ArrayList<PaintStroke>();
		}
		DbDataHelper.getPaintStrokeList(context, mId, mStrokes);
	}
}
